﻿<?php header('Content-Type: text/xml'); ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>


<?php

	$dbc = mysqli_connect( 'localhost' ,'root' , '1234', 'teresa' ) or die( 'Error connecting to MySQL server.');		
	$message_id = $_GET['message_id'];
	echo '<result>';
	echo '<item>';	

	if( !empty( $message_id ) ){
		$query = "SELECT * FROM teresa_message WHERE message_id = '$message_id'";
		$data = mysqli_query( $dbc , $query) or die('ERROR queerying database.');

		$row = mysqli_fetch_array( $data );
		$subject = $row['subject'];
		$message = $row['message'];
		$response = $row['response'];
		$location_x = $row['location_x'];
		$location_y = $row['location_y'];
		$category = $row['category'];
		$category2 = $row['category2'];
		$maximum = $row['maximum'];
		$message_id = $row['message_id'];
		$d_day = $row['message'];
		$sender = $row['sender'];
		$reciever = $row['reciever'];
		$address = $row['address'];

		echo '<A>' .$subject. '</A>' ;
		echo '<B>' .$message. '</B>' ;	
		echo '<C>' .$response. '</C>';
		echo '<D>' .$location_x . '</D>';	
		echo '<E>' .$location_y. '</E>' ;
		echo '<F>' .$category. '</F>' ;	
		echo '<G>' .$category2. '</G>';
		echo '<H>' .$maximum . '</H>';	
		echo '<I>' .$message_id. '</I>' ;
		echo '<J>' .$d_day.'</J>' ;	
		echo '<K>' .$sender. '</K>' ;
		echo '<L>' .$reciever. '</L>';	
		echo '<M>' .$address. '</M>';
	}	 
	echo '</item>';	
	echo '</result>';
?>
	
